#pragma once
#include "mythread.h"
#include "u_t.h"
#include <fstream>
#include <iostream>
#include <gsl/gsl_rng.h>
#include <gsl/gsl_randist.h>
#include <gsl/gsl_errno.h>
#include <gsl/gsl_spline.h>
class u_i :
	public myThread,public rscjprops
{
public:
	u_i(void);
	u_i(double Rn,double Ic,double C, double w);
	u_i(double betac, double omega);
	
	void write();
	void setDeltai(double deltai);
	void setDeltai(std::vector<double> deltai);
	void setimax(double imax);
	void setImax(double Imax);
	void setimin(double imin);
	void setImin(double Imin);
	void setiasy(double iays);
	void setIasy(double Iasy);
	void setiex(double iex);
	void setIex(double Iex);
	void setsmax(double smax);
	void setfilename(std::string name);
	
	void setDeltaI(double deltaI);
	void setDeltaI(std::vector<double> deltaI);
	double getDeltai();
	double getDeltaI();
	double getimax();
	double getImax();
	double getimin();
	double getImin();
	double getiasy();
	double getIasy();
	double getiex();
	double getIex();
	double getsmax();
	std::string getfilename();
		~u_i(void);
	std::vector<long double> I;
	std::vector<long double> U;
	std::vector<long double> irnd;
	

	void work(void);
private:

//	void work(void);
	double imin;
	double Imin;
	double imax;
	double Imax;
	double deltai;
	double deltaI;
	double Iasy;
	double iasy;
	double Iex;
	double iex;
	bool constI;
	u_t utobj;
	long double calcu(long double i,long double u);
	long double calcU(long double i,long double u);
	double smax;
	double tmax;
	double error;
	std::string filename;
	double interpol_lin(std::vector<long double> xdata,std::vector<long double> ydata, double x,int n1);
	void temp();
	long double getNoise(long double sigma);
	void dec_dI();
	void inv_dec_dI();
	//gsl_interp_accel *acc;
	//gsl_spline *spline;


};

